<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display"%>
<script type="text/javascript"
	src="<%= request.getContextPath() + "/js/calendar6.js" %>"></script>
<script type="text/javascript"
	src="<%= request.getContextPath() + "/js/popUP.js" %>"></script>
<link href="<%= request.getContextPath() + "/css/bloques.css" %>"
	rel="stylesheet" type="text/css">


<script type="text/javascript">
  function buscarSubprogramas(accion){
    document.frmUsuarioSubprog.action = '<%=request.getContextPath()+"/Sedes/UsuarioSubprograma.do"%>';
    document.frmUsuarioSubprog.accion.value = accion;
    document.frmUsuarioSubprog.submit();
  }
  
  function activar()
  {
      document.frmUsuarioSubprog.continuar.disabled=false;
  }
  
</script>
<script src="<%=request.getContextPath()%>/js/displaytag.js"
	type="text/javascript"></script>
<form name="frmUsuarioSubprog"
	action="<%=request.getContextPath()+"/Sedes/UsuariosxSede.do"%>"
	method="get">
	<div align="center">
		<table class="tablaGenericaWidth70">
			<!--<form name="frmUsuarioSubprog" action="<%=request.getContextPath()+"/Sedes/EscogerUsuario.do"%>" method="get">-->
			<tr>
				<td class="titulosenblanco" colspan="3">
					<DIV align="center">
						<STRONG>Usuarios que asignar&aacute;n beneficios</STRONG>
					</DIV>
				</td>
			</tr>
			<tr>
				<td class="titulosenblanco" colspan="3">&nbsp;</td>
			</tr>
			<tr>
				<td align="center" class="celdatabla" colspan="3">Seleccione
					una opcion</td>
			</tr>
			<tr>
				<td class="titulosenblanco" colspan="3">&nbsp;</td>
			</tr>

			<tr>
				<td class="celdatabla" width="31%">Programa:</td>
				<td width="44%"><logic:notPresent name="programas">
						<DIV align="center">
							<%= session.getAttribute("msg")%>
						</DIV>
					</logic:notPresent> <%   Object codePrograma = request.getParameter("codePrograma"); %>
					<div align="left">
						<logic:present name="programas">
							<logic:iterate id="programa" name="programas" length="1"
								type="co.gov.medellin.ssti.sub.model.vo.ProgramaVO">
								<html:select name="programa" property="codePrograma"
									onchange="buscarSubprogramas('1');" title="Programa"
									styleClass="form" value="<%=(String)codePrograma%>">
									<option value="nulo">Seleccione un programa</option>
									<html:options name="programas" labelName="codigo"
										labelProperty="nombre" property="code" collection="programas" />
								</html:select>
							</logic:iterate>
						</logic:present>
					</div></td>
				<td class="celdatabla" width="25%">&nbsp;</td>
			</tr>
			<% 
     if(codePrograma != null){
  %>
			<tr>
				<td class="celdatabla" width="31%">Beneficio:</td>
				<td width="44%">
					<div align="left">
						<logic:notPresent name="subprogramas">
							<DIV align="center">
								<%= session.getAttribute("msg")%>
							</DIV>
						</logic:notPresent>
						<%   Object codeSubPrograma = request.getParameter("codeSubPrograma"); 
             if(codeSubPrograma==null) codeSubPrograma = "nulo";
       %>
						<logic:present name="subprogramas">
							<logic:iterate id="subprograma" name="subprogramas" length="1"
								type="co.gov.medellin.ssti.sub.model.vo.SubprogramaVO">
								<html:select name="subprograma" property="codeSubPrograma"
									title="Programa" styleClass="form"
									value="<%=(String)codeSubPrograma%>"
									onchange="buscarSubprogramas('1');">
									<option value="nulo">Seleccione un subprograma</option>
									<html:options name="subprogramas" labelName="codigo"
										labelProperty="nombre" property="code"
										collection="subprogramas" />
								</html:select>
							</logic:iterate>
						</logic:present>
					</div>
				</td>
				<td class="celdatabla" width="25%">&nbsp;</td>
			</tr>
			<% 
     }
     Object codeSubprog = request.getParameter("codeSubPrograma");
     if(codeSubprog != null)
     {
  %>
			<tr>
				<td class="celdatabla" width="31%">Sedes:</td>
				<td width="44%">
					<div align="left">
						<logic:notPresent name="sedes">
							<DIV align="center">
								<% if(session.getAttribute("msg") != null) { %>
								<%= session.getAttribute("msg")%>
								<% } %>
							</DIV>
							<%session.removeAttribute("msg");%>
						</logic:notPresent>
						<%    Object codeSede = request.getParameter("codeSede"); 
        if(codeSede==null) codeSede = "nulo";
  %>

						<logic:present name="sedes">
							<logic:iterate id="sede" name="sedes" length="1"
								type="co.gov.medellin.ssti.sub.model.vo.SedeVO">
								<html:select onclick="activar()" name="sede" property="code"
									title="Sede" styleClass="form" value="<%=(String)codeSede%>">
									<html:options name="sede" labelName="codeSede"
										labelProperty="nombre" property="code" collection="sedes" />
								</html:select>
							</logic:iterate>
						</logic:present>
					</div>
				</td>
			</tr>
			<%}%>
			<tr>
				<td class="celdatabla" width="31%">&nbsp;</td>
				<td width="44%">
					<div align="center">
						<input type="HIDDEN" name="accion" /> <input type="HIDDEN"
							name="option" value="ConUsu" /> <input type="SUBMIT"
							disabled="disabled" value="Continuar" name="continuar" />
						<P></P>
					</div>
				</td>
				<td class="celdatabla" width="25%">&nbsp;</td>
			</tr>
		</table>
	</div>
</form>



